<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Object.is</title>
</head>
<body>
    <script>
        // object.is 和 === 处理一致的情况如下
        console.log("1===1" ,1===1, Object.is(1, 1));
        console.log("'1'==='1'" ,'1'==='1', Object.is('1', '1'));
        console.log("true===true" ,true===true, Object.is(true, true));
        console.log("null===null" ,null===null, Object.is(null, null));
        console.log("undefined===undefined" ,undefined===undefined, Object.is(undefined, undefined));
        console.log("1 === '1'" ,1 === '1', Object.is(1, '1'));
        console.log("1 === true" ,1 === true, Object.is(1, true));
        console.log("null === undefined" ,null === undefined, Object.is(null, undefined));
        let obj1 = {name: 'o'}; 
        let obj2 = obj1;
        let obj3 = {name: 'o'};
        console.log('数据源相同', obj1 === obj2, Object.is(obj1, obj2));
        console.log('数据值相同', obj1 === obj3, Object.is(obj1, obj3));
        // 检查NaN +0 -0
        console.log('NaN', NaN === NaN, Object.is(NaN, NaN)); //NaN false true
        console.log('0 -0', +0 === -0, Object.is(+0, -0)); // 0 -0 true false
    </script>
</body>
</html>